#pragma once

#include "IEvent.h"
#include "EntityController.h"
#include "IBehavior.h"

class MinionBehavior : public IBehavior
{
public:
	static Pointer<IBehavior> Create( EntityController* controller );

	static const HashedString type;

	const HashedString& Type() const;

	MinionBehavior( EntityController* controller );
	bool Destination( IEvent& event );
	bool DestinationReached( IEvent& event );
	bool AddDestination( IEvent& event );
	Entity* FindClosestEnemy();
	void Update();
	void DoAutoAttack();
	
	HashedString EnemyGroup();
	void EnemyGroup( HashedString name );

	bool ToXML( tinyxml2::XMLPrinter& printer );
	bool FromXML( tinyxml2::XMLElement* element );
protected:
	enum State
	{
		DEFAULT = 0,
		ATTACKING = 1,
	};

	State m_state;


	Entity* m_engagedEnemy;

	HashedString m_enemyGroup;

	Time m_lastMoveTime;
	Time m_lastPathTime;
	Time m_lastAutoAttack;
};